//
//  LSYellowPageCollectionViewCell.m
//  LaSaCivilAffairsDepartment
//
//  Created by 聂志康 on 2019/1/3.
//  Copyright © 2019 wpkj. All rights reserved.
//

#import "LSYellowPageCollectionViewCell.h"

@interface LSYellowPageCollectionViewCell ()
@property (nonatomic, strong) UIImageView *mainImageView;
@property (nonatomic, strong) UILabel *mainTitleLabel;
@end

@implementation LSYellowPageCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self.contentView addSubview:self.mainImageView];
        [self.contentView addSubview:self.mainTitleLabel];
    }
    return self;
}

- (void)setContent:(NSString *)content {
    _content = content;
    self.mainImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"icon%@",content]];
    self.mainTitleLabel.text = content;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    WS
    [self.mainTitleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.contentView.mas_top).with.offset(88);
        make.left.equalTo(weakSelf.contentView.mas_left).with.offset(20);
        make.right.equalTo(weakSelf.contentView.mas_right).with.offset(-20);
    }];
}

- (UIImageView *)mainImageView {
    if (!_mainImageView) {
        _mainImageView = [[UIImageView alloc] initWithFrame:CGRectMake(((ScreenWidth/3)-50)/2, 23, 50, 50)];
        _mainImageView.contentMode = UIViewContentModeScaleAspectFit;
    }
    return _mainImageView;
}

- (UILabel *)mainTitleLabel {
    if (!_mainTitleLabel) {
        _mainTitleLabel = [[UILabel alloc] init];
        _mainTitleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        _mainTitleLabel.textColor = hexColor(333333);
        _mainTitleLabel.textAlignment = NSTextAlignmentCenter;
        _mainTitleLabel.numberOfLines = 3;
    }
    return _mainTitleLabel;
}
@end
